home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln1085.arc
/
ALTER.ART
< prev
next >
Wrap
Text File
|
1986-02-27
|
14KB
|
292 lines
FORT╚ i≤ sometime≤ saiΣ t∩ bσ it≤ owε operatinτ system¼ anΣ therσ ì
arσ certainl∙ system≤ wherσ thi≤ i≤ true« However¼ microcompute≥ ì
user≤ morσ ofteε ruε FORT╚ unde≥ anothe≥ operatinτ systeφ sucΦ a≤ ì
CP/═ o≥ MSDOS¼á anΣ thσ relationshi≡ i≤ no⌠ alway≤ a≤ happ∙ a≤ i⌠ ì
migh⌠á be«á Onσ majo≥ conflic⌠ i≤ tha⌠ FORT╚ divide≤ disδá spacσ ì
int∩ uniforφ ▒ kilobytσ screens¼á whilσ thσ hos⌠ operatinτ systeφ ì
use≤á variablσá lengtΦ files«á Sincσ FORT╚ doe≤ no⌠ respec⌠á thσ ì
operatinτá systeφá disδá directory¼á i⌠ i≤á difficul⌠á fo≥á FORT╚ ì
screen≤ anΣ file≤ t∩ coexis⌠ oε thσ samσ disk.
Thσ probleφ get≤ worsσ becausσ commonl∙ availablσ screeεá editor≤ ì
arσ designeΣ t∩ handlσ file≤ rathe≥ thaε FORT╚ screens« Ordinar∙ ì
file≤á arσá madσá u≡á oµ variablσ lengtΦá line≤á separateΣá b∙á ß ì
carriagσ return/linσ feeΣ pai≥ o≥ somσ simila≥ convention¼á whilσ ì
FORT╚á screen≤ arσ usuall∙ divideΣ int∩ 1╢ fixeΣ lengtΦ line≤á oµ ì
6┤á characters¼á anΣ looδ likσ gibberisΦ t∩ ß filσ editor«á Somσ ì
commercia∞ version≤ oµ FORT╚ arσ no≈ beinτ provideΣ witΦ suitablσ ì
screeε editor≤ t∩ solvσ thi≤ problem.
╔á worδ witΦ thσ publiπ domaiε versioε oµ FORT╚ 7╣ froφá Mountaiε ì
Vie≈á Press«á Thi≤ camσ witΦ ß linσ edito≥ tha⌠á work≤á directl∙ ì
froφá thσá FORT╚ commanΣ level¼á s∩ tha⌠ editinτ command≤ caεá bσ ì
intersperseΣ witΦ othe≥ FORT╚ words«á Unfortunately¼ ╔ finΣ thi≤ ì
edito≥á slo≈á anΣá frustratinτ iε comparisoεá t∩á ßá ful∞á screeε ì
editor«á Whilσá somσá FORT╚ screeε editor≤ arσ availablσ iεá thσ ì
publiπ domain¼á thei≥ command≤ var∙ froφ thosσ oµá WordStar¼á thσ ì
screeεá edito≥á tha⌠ ╔ usσ mos⌠ often«á ╔ decideΣ tha⌠á ╔á woulΣ ì
rathe≥ learε t∩ writσ aε edito≥ thaε learε ß ne≈ syntax¼á anΣ thσ ì
resul⌠á wa≤ ALTER--ß FORT╚ screeε edito≥ witΦ WordSta≥ work-alikσ ì
commands.
USING ALTER
Ho≈á doe≤ ALTE╥ work┐á Oncσ thσ word≤ ALTE╥ anΣ A╠ arσá iεá you≥ ì
FORT╚á dictionary¼á yo⌡á invokσá thσ edito≥ b∙ typinτá SCR▒á SCR▓ ì
ALTER¼ wherσ SCR▒ anΣ SCR▓ arσ thσ firs⌠ anΣ las⌠ FORT╚ block≤ iε ì
thσá rangσ yo⌡ wil∞ bσ editing«á ALTE╥ no≈ begin≤á trappinτá al∞ ì
keyboarΣ input¼ whicΦ i⌠ interpret≤ eithe≥ a≤ editinτ command≤ o≥ ì
character≤á t∩ bσ addeΣ t∩ thσ curren⌠ screen«á Yo⌡ arσ onσ ste≡ ì
awa∙ froφ thσ FORT╚ commanΣ level¼á s∩ othe≥ FORT╚ word≤ arσá no⌠ ì
directl∙ accessible«á However¼ thσ worΣ A╠ make≤ i⌠ eas∙ t∩ movσ ì
iεá anΣá ou⌠á oµ thσ editor«á Afte≥ yo⌡ exi⌠á witΦá thσá contro∞ ì
sequencσ ^KD¼á typinτ A╠ witΦ nothinτ oε thσ stacδ wil∞ returε t∩ ì
editinτ thσ screeε froφ whicΦ yo⌡ exited.
ALTE╥á provide≤á thσ feature≤ oµ ful∞ screeε editor≤ tha⌠ ╔á finΣ ì
usefu∞ fo≥ writinτ FORT╚ programs¼á bu⌠ omit≤ thσá frills«á Thi≤ ì
mean≤á tha⌠á freσá curso≥ movement¼á tex⌠ entry/deletioεá a⌠á thσ ì
cursor¼á insert/overwritσ modes¼ search/replace¼ blocδ operation≤ ì
anΣ macro≤ arσ available¼ whilσ formattinτ anΣ prin⌠ command≤ arσ ì
omitted.
Mos⌠ command≤ fo≥ curso≥ movement¼á tex⌠ entry¼á anΣ deletioε arσ ì
thσá samσ a≤ iε WordStar«á Wheε aε adaptatioε t∩ FORT╚ wa≤á ver∙ ì
obviou≤á (e.g«á makinτá ^├á anΣ ^╥ movσ forwarΣ o≥á backwarΣá onσ ìèscreen)¼á ╔á maintaineΣ thσ origina∞ ke∙ sequence«á Bu⌠ iεá man∙ ì
cases¼á thσá blocδá structurσá oµá FORT╚á virtua∞á memor∙á needeΣ ì
operation≤ no⌠ closel∙ analogou≤ t∩ anythinτ iε WordStar« Rathe≥ ì
thaε risδ confusioε b∙ redefininτ thσ WordSta≥ commanΣ set¼ ╔ pu⌠ ì
al∞á thesσ command≤ oε ß ne≈ menu«á Sincσ WordSta≥ alread∙á use≤ ì
mos⌠ contro∞ sequences¼ ╔ prefixeΣ thσ ne≈ men⌡ witΦ ^\¼ whicΦ oε ì
thσá Osbornσ keyboarΣ generate≤ aε ASCI╔ 28«á Fo≥á example¼á ^\╙ ì
wil∞á promp⌠ fo≥ ß screeε numbe≥ anΣ theε movσ directl∙á t∩á tha⌠ ì
screen.
Iµá yo⌡ havσ difficult∙ generatinτ aε ASCI╔ 2╕ froφ thσá keyboarΣ ì
iε you≥ system¼ thσ choicσ caε easil∙ bσ changeΣ b∙ modifyinτ thσ ì
worΣá CMENU«á Iε fact¼á an∙ oµ thσ contro∞ ke∙ sequence≤ caεá bσ ì
redefineΣ b∙ changinτ thσ CAS┼ statement≤ iε CMENU¼á KMENU¼ QMEN╒ ì
o≥á \MENU¼á s∩á t∩ ß fai≥ exten⌠ yo⌡ caε makσ ALTE╥ resemblσá an∙ ì
edito≥ yo⌡ prefer.
A≤á iεá WordStar¼á yo⌡ caε choosσ betweeεá inser⌠á anΣá overwritσ ì
modes« Followinτ thσ convenien⌠ edito≥ provideΣ b∙ Turb∩ Pascal¼ ì
╔á als∩á provideΣ aε autoinden⌠ modσ tha⌠ caε bσ switcheΣ oεá anΣ ì
off«á Tab≤ arσ adjustablσ t∩ an∙ fixeΣ value¼ bu⌠ d∩ not linσ u≡ ì
witΦá word≤ oε thσ linσ abovσ a≤ iε thσ Turb∩á editor«á AlthougΦ ì
prin⌠á formattinτá command≤ arσ no⌠ included¼á ^K╨ wil∞á prin⌠á ß ì
rangσ oµ screen≤ t∩ you≥ lis⌠ device.
Search/replacσá anΣá blocδá operation≤ arσ provideΣá iεá somewha⌠ ì
simplifieΣ form«á Yo⌡ caε search¼á searcΦ witΦ automatiπ replacσ ì
o≥ searcΦ witΦ prompteΣ replace¼ bu⌠ backwarΣ o≥ globa∞ searchinτ ì
anΣ wildcarΣ searche≤ arσ no⌠ implemented«á Blocδ operation≤á arσ ì
limiteΣ t∩ block≤ consistinτ oµ wholσ line≤ anΣ existinτ withiε ß ì
singlσá FORT╚ screen«á Whilσ thσ Turb∩ edito≥ include≤ ß commanΣ ì
t∩á marδá onσ worΣ a≤ ß block¼á ╔ founΣ i⌠ morσ usefu∞ t∩á adΣá ß ì
commanΣ tha⌠ mark≤ thσ curren⌠ linσ a≤ ß block.
Thσá ^▄á men⌡ provide≤ ß numbe≥ oµ command≤á fo≥á conveniencσá iε ì
handlinτá FORT╚á screens«á ^\╟ wil∞ wipσ thσ curren⌠á screeεá b∙ ì
fillinτá i⌠ witΦ blanks«á ^\╚ wil∞ restorσ thσ curren⌠ screeε t∩ ì
it≤á statσá beforσ yo⌡ entereΣ it¼á anΣ thu≤ provide≤á ßá wa∙á t∩ ì
recove≥á froφá editinτá mistake≤ s∩ lonτ a≤ yo⌡ d∩á no⌠á leavσá ß ì
screen« (ALTE╥ flushe≤ eacΦ screeε t∩ disδ wheε yo⌡ leavσ it¼ s∩ ì
yo⌡á caε neve≥ losσ morσ thaε onσ screeε oµ tex⌠ a⌠ ß time.⌐ ^\╥ ì
anΣ ^\╫ allo≈ yo⌡ t∩ reaΣ o≥ writσ betweeε thσ curren⌠ screeε anΣ ì
anothe≥á designateΣá screen¼á whilσ ^\N¼á ^\┘ anΣ ^\┴á allo≈á fo≥ ì
screeε insertion¼ deletioε anΣ swapping.
Finally¼á ALTE╥á allow≤á yo⌡ t∩ storσ frequentl∙ useΣá serie≤á oµ ì
command≤ o≥ piece≤ oµ tex⌠ iε macros«á Wheε ß macr∩ i≤á invoked¼ ì
inpu⌠á i≤ diverteΣ t∩ thσ storeΣ serie≤ oµ keystrokes¼á whicΦ arσ ì
theεá interpreteΣá a≤ thougΦ ALTE╥ werσ receivinτ theφá froφá thσ ì
keyboard«á U≡ t∩ 1╢ macro≤ caε bσ availablσ a⌠ onσ time«á Sincσ ì
the∙á arσá storeΣá a≤ thσ 1╢ line≤ oµ ßá FORT╚á screeεá anΣá sucΦ ì
screen≤á caεá bσá reaΣ iε anΣ ou⌠ oµ mas≤ storage¼á therσá i≤á n∩ ì
practica∞ limi⌠ t∩ thσ numbe≥ oµ macro≤ yo⌡ caε kee≡ oε hand.
┴ numbe≥ oµ safeguard≤ arσ buil⌠ int∩ ALTER«á Numeriπ input≤ arσ ìècheckeΣá fo≥á prope≥á range¼á anΣ strinτ input≤á arσá clippeΣá t∩ ì
acceptablσ length«á GarbleΣ numeriπ input≤ containinτá character≤ ì
othe≥áá thaεá digit≤á wil∞á causσá ALTE╥á t∩á complaiεá unti∞á aε ì
acceptablσá numbe≥á i≤ received«á Thσá highes⌠á possiblσá screeε ì
numbe≥á fo≥ you≥ systeφ shoulΣ bσ placeΣ iε thσ constan⌠ MAX_SCR¼ ì
anΣá attempt≤á t∩á movσ o≥ writσ beyonΣ MAX_SC╥á wil∞á theεá fai∞ ì
harmlessly«á Attempt≤ t∩ movσ o≥ writσ outsidσ thσ editinτá rangσ ì
citeΣ wheε enterinτ ALTE╥ wil∞ promp⌠ fo≥ confirmation«
SOME COMMENTS ON THE PROGRAM
Afte≥á usinτá thσá MV╨ FORT╚ linσ edito≥á t∩á writσá thσá prograφ ì
skeletoεá anΣá ßá fe≈ ke∙ word≤ fo≥á curso≥á movement¼á characte≥ ì
insertioε anΣ screeε refresh¼á ╔ haΣ ß primitivσ versioε oµ ALTE╥ ì
tha⌠ coulΣ bσ useΣ t∩ finisΦ writinτ itself« Onσ benefi⌠ oµ thi≤ ì
approacΦá wa≤ tha⌠ mos⌠ debugginτ haΣ t∩ bσá accomplisheΣá beforσ ì
thσ sourcσ codσ wa≤ finished«
Everythinτá wa≤ writteε iε straigh⌠ FORT╚ a⌠ first¼á anΣ thσ onl∙ ì
functioεá tha⌠á seemeΣá to∩ slo≈ oεá completioεá wa≤á thσá searcΦ ì
command«á Rewritinτá onσ lo≈ leve∞ worΣ iε Z8░ assembl∙ languagσ ì
brough⌠ thi≤ u≡ t∩ adequatσ speed«á Sincσ no⌠ everyonσ ma∙á havσ ì
acces≤á t∩ ß FORT╚ assemble≥ (anΣ sincσ ╔ havσ stil∞ no⌠á learneΣ ì
t∩á usσá thσá onσá iε m∙ possession)¼á thσ codσá worΣá i≤á pieceΣ ì
togethe≥ bytσ b∙ bytσ oε onσ oµ thσ sourcσ screens« ┴ higΦ leve∞ ì
FORT╚á versioεá i≤á als∩ provideΣ fo≥ temporar∙á usσá oεá non-Z8░ ì
systems.
Mos⌠ oµ thσ FORT╚ codσ i≤ simple¼á anΣ migh⌠ havσ beeε donσá morσ ì
subtl∙á o≥á efficientl∙ b∙ aε experienceΣ FORT╚á programmer«á M∙ ì
firs⌠á aiφá wa≤ t∩ writσ word≤ tha⌠ workeΣ correctl∙á witΦá name≤ ì
tha⌠á suggesteΣ thei≥ functions¼á anΣ ╔ trieΣ t∩ usσá indentatioε ì
anΣ spacinτ iε ß wa∙ tha⌠ woulΣ makσ thσ codσ eas∙ t∩ read«
Thσ organizatioε oµ thσ prograφ i≤ als∩ simple« Thσ corσ i≤ showε ì
iε listinτ 1« Wheε yo⌡ typσ SCR▒ SCR▓ ALTER¼ thσ worΣ SET_BOUND╙ ì
define≤á thσá editinτ rangσ accordinτ t∩ thσá tw∩á stacδá values« ì
GREETIN╟á theεá print≤á thσ log-oεá message¼á anΣá thσá remaininτ ì
function≤á oµ ALTE╥ arσ performeΣ b∙ AL«á A╠ call≤ oεá GET_READ┘ ì
fo≥ somσ initializatioε anΣ theε enter≤ ß loo≡ tha⌠ repeat≤ unti∞ ì
usσ oµ thσ ^K─ commanΣ set≤ aε exi⌠ flag«á Thσ loo≡ bod∙ i≤ jus⌠ ì
threσá words║á KEY¼á whicΦá get≤á aε inpu⌠á characte≥á froφá thσ ì
keyboard╗á MENU¼á whicΦá interpret≤ thσ character╗á anΣá REFRESH¼ ì
whicΦ redraw≤ thσ memor∙ mappeΣ vide∩ screeε wheε required.
MEN╒á i≤ thσ hear⌠ oµ thσ editor¼á anΣ it≤ onl∙ joΓ i≤ t∩á decidσ ì
whethe≥ thσ inpu⌠ characte≥ i≤ ß contro∞ characte≥ o≥ ß characte≥ ì
oµá text«á Iµá i⌠ i≤ ß contro∞ character¼á MEN╒ passe≤ i⌠ oεá t∩ ì
ß largσ CAS┼ statemen⌠ iε CMENU¼á whicΦ eithe≥ take≤á appropriatσ ì
actioε o≥ call≤ onσ oµ thσ submenu≤ KMENU¼á QMEN╒ anΣ \MENU«á Iµ ì
i⌠á i≤á aε ordinar∙ character¼á MEN╒ passe≤ i⌠ t∩á DO_CHA╥, whicΦ ì
eithe≥á insert≤ i⌠ o≥ overwrite≤ i⌠ a⌠ thσ curso≥ position«á Thσ ì
men⌡á structurσá make≤ ALTE╥ eas∙ t∩ extend«á Iµ yo⌡á wan⌠á morσ ì
functions¼á jus⌠á writσ word≤ t∩ carr∙ theφ ou⌠ anΣá inser⌠á theφ ì
int∩ thσ appropriatσ menu.è
Thσá word≤á calleΣ b∙ thσ fou≥ menu≤ perforφ thσ actua∞á worδá oµ ì
updatinτá memor∙á anΣ movinτ thσ cursor¼á bu⌠ d∩ nothinτá t∩á thσ ì
vide∩ display«á Instead¼á the∙ se⌠ flag≤ t∩ tel∞ REFRES╚ whethe≥ ì
i⌠ need≤ t∩ redra≈ thσ wholσ screeε o≥ jus⌠ thσ curren⌠ line¼ anΣ ì
whethe≥ thσ statu≤ linσ shoulΣ als∩ bσ updated«á Thi≤ i≤ simple≥ ì
thaε havinτ eacΦ worΣ d∩ it≤ owε displa∙ update¼ anΣ ensure≤ tha⌠ ì
eveεá comple°á operation≤ wil∞ no⌠ redra≈ thσá screeεá morσá thaε ì
once.
Thosσá wh∩á arσá no⌠á familia≥á witΦ Le∩á Brodie'≤á DOE╥á »á MAK┼ ì
constructioε ma∙ enjo∙ seeinτ ho≈ thesσ word≤ arσ useΣ iεá ALTER« ì
DOE╥á i≤á ß defininτ worΣ useΣ t∩ creatσ placeholde≥á word≤á tha⌠ ì
initiall∙á d∩á nothing«á Later¼á thσá worΣ MAK┼á caεá definσá o≥ ì
redefinσ thσ actioε tha⌠ wil∞ takσ placσ wheε sucΦ ß placeholde≥ ì
i≤ encountered«
Aεá examplσ froφ thσ sourcσ codσ oµ ALTE╥ i≤ showε iε Listinτá 2« ì
Thσ worΣ GET_VALID_NUMBE╥ i≤ useΣ b∙ word≤ tha⌠ neeΣ t∩ receivσ ß ì
numbe≥á withiε somσ acceptablσ range«á Sincσ thi≤ rangσá ma∙á bσ ì
differen⌠á fo≥á eacΦ case¼á DOE╥ i≤ useΣ t∩ creatσá OKAY?¼á whicΦ ì
fill≤á thσ placσ oµ thσ rangσ specification«á EacΦ highe≥á leve∞ ì
worΣá sucΦá a≤á GET_SCREE╬á o≥ SELECT_MACR╧á theεá use≤á MAK┼á t∩ ì
definσ OKAY┐ a≤ ß specifiπ rangσ beforσ callinτ GET_VALID_NUMBER.
Morσ example≤ oµ DOE╥ » MAK┼ arσ showε iε Listinτ 3« Wheε ß macr∩ ì
i≤á invoked¼á thσá worΣ DO_MACR╧ get≤ character≤ froφ thσá storeΣ ì
macr∩á definitioεá anΣ interpret≤ theφ a≤ iµ the∙ camσá froφá thσ ì
keyboard«á Iεá orde≥ t∩ d∩ this¼á DO_MACR╧ need≤ t∩ cal∞ oεá thσ ì
worΣá MENU¼á whicΦá interpret≤á al∞á characte≥á input«á However¼ ì
DO_MACR╧ itselµ i≤ ß worΣ calleΣ indirectl∙ b∙ MENU¼á s∩ therσ i≤ ì
ß probleφ iε defininτ eithe≥ worΣ beforσ thσ other«á Thσá answe≥ ì
i≤ t∩ havσ DO_MACR╧ cal∞ thσ placeholde≥ MENU'¼á createΣ b∙ DOER« ì
Later¼á wheε MEN╒ ha≤ beeε defined¼ wσ sa∙ MAK┼ MENUº MENU¼ whicΦ ì
complete≤ thσ forwarΣ reference«
A≤ ß fina∞ example¼ KEYº normall∙ default≤ t∩ thσ FORT╚ primitivσ ì
KEY¼á whicΦá get≤ aε inpu⌠ characte≥ froφ thσá keyboard«á Durinτ ì
macr∩ execution¼á KEYº change≤ t∩ MACRO@¼á s∩ tha⌠ thσ men⌡ word≤ ì
tha⌠ cal∞ oε KEYº wil∞ insteaΣ obtaiε character≤ froφ thσá storeΣ ì
macr∩ sequence.
ALTE╥á wa≤á writteε fo≥ aε Osbornσ ▒ compute≥ anΣá ha≤á no⌠á beeε ì
testeΣá oε anythinτ else«á However¼á i⌠ shoulΣ bσ fairl∙ eas∙ t∩ ì
adap⌠á t∩á an∙á systeφ witΦ memor∙á mappeΣá video«á Al∞á Osbornσ ì
specifiπá addresse≤á havσ beeε isolateΣ iε nameΣá constants¼á anΣ ì
definition≤á tha⌠á ma∙ neeΣ adjustmen⌠ arσ flaggeΣ iε thσá sourcσ ì
codσ witΦ thσ commen⌠ ¿ ?PORTABL┼ )«á ╔ hopσ tha⌠ ALTE╥ wil∞á bσ ì
porteΣ t∩ othe≥ systems¼ anΣ ╔ wil∞ bσ interesteΣ iε hearinτ froφ ì
anyonσ wh∩ succeed≤ iε this.
FORT╚á user≤á havσ benefiteΣ greatl∙ froφ generou≤ publiπá domaiε ì
contributions¼ includinτ severa∞ version≤ oµ thσ languagσ itself« ì
ALTE╥ i≤ ß les≤ ambitiou≤ effort¼á bu⌠ ╔ hopσ tha⌠ it≤ similarit∙ ì
t∩á ßá popula≥á ful∞á screeε edito≥á wil∞á increasσá thσá fuεá oµ ìèprogramminτá iε FORTH«á Thσ prograφ anΣ it≤ supportinτ file≤á arσ ì
availablσ oε thσ Compute≥ Languagσ bulletiε board«á ALTE╥ ma∙ bσ ì
copieΣá anΣá modifieΣá fo≥ persona∞ use¼á anΣ ╔ looδá forwarΣá t∩ ì
improvement≤ anΣ extension≤ b∙ thosσ wh∩ usσ it.
Listing 1
: REFRESH
SCREEN_FLAG @ IF REFRESH_SCREEN ELSE
LINE_FLAG @ IF REFRESH_LINE THEN THEN
STATUS_FLAG @ IF REFRESH_STATUS THEN
REFRESH_CURSOR PROMPT ;
(later in source code)
: MENU ( CHAR -- )
DUP CONTROL? IF CMENU ELSE DO_CHAR THEN ;
(later in source code)
: AL
GET_READY
BEGIN EXIT_FLAG @ 0= WHILE KEY MENU REFRESH REPEAT ;
: ALTER
SET_BOUNDS GREETING AL ;
Listing 2
DOER OKAY?
: GET_VALID_NUMBER ( -- N )
BEGIN
GET_NUMBER DUP OKAY?
NOT WHILE
DROP PROMPT ." OUT OF RANGE. TRY AGAIN: "
REPEAT ;
(later in source code)
: GET_SCREEN ( -- N )
MAKE OKAY? 0 MAX_SCR WITHIN? ;AND GET_VALID_NUMBER ;
: SELECT_MACRO
MAKE OKAY? 0 15 WITHIN? ;AND
LOAD_MACROS PROMPT ." MACRO NUMBER (0 - 15): "
GET_VALID_NUMBER MACRO# ! PLUG ;
Listing 3
DOER MENU'
DOER KEY'è
MAKE KEY' KEY ; SMUDGE
: DO_MACRO
MACRO# @ 0 15 WITHIN? NOT IF SELECT_MACRO THEN
MAKE KEY' MACRO@ ;AND RESET_MACRO
BEGIN MACRO@ ?DUP WHILE MENU' REFRESH REPEAT
MAKE KEY' KEY ;
(later in source code)
: KMENU
KEY' FILTER CASE
(rest of ^K menu definition) ;
(KEY' will usually be KEY, but if KMENU was called from
within DO_MACRO, KEY' will be MACRO@.)
: MENU ( CHAR -- )
DUP CONTROL? IF CMENU ELSE DO_CHAR THEN ;
(MENU calls CMENU, which calls \MENU, which calls DO_MACRO)
MAKE MENU' MENU ; SMUDGE